StyleManager

open class StyleManager : Observable, StyleManagerInterface

Interface for managing style of the `map`.

Functions

addPersistentStyleCustomLayer
Link copied to clipboard
open fun addPersistentStyleCustomLayer(@NonNull() layerId: String, @NonNull() layerHost: CustomLayerHost, @Nullable() layerPosition: LayerPosition): Expected<String, None>
Adds a new [style custom layer](https://docs.mapbox.com/mapbox-gl-js/style-spec/#layers).Note: This is an experimental API and is a subject to change.Whenever a new style is being parsed and currently used style has persistent layers,an engine will try to do following:- keep the persistent layer at its relative position- keep the source used by a persistent layer- keep images added through `addStyleImage` methodIn cases when a new style has the same layer, source or image resource, style's resources would beused instead and `MapLoadingError` event will be emitted.
addPersistentStyleLayer
Link copied to clipboard
open fun addPersistentStyleLayer(@NonNull() properties: Value, @Nullable() layerPosition: LayerPosition): Expected<String, None>
Adds a new [style layer](https://docs.mapbox.com/mapbox-gl-js/style-spec/#layers).Note: This is an experimental API and is a subject to change.Whenever a new style is being parsed and currently used style has persistent layers,an engine will try to do following:- keep the persistent layer at its relative position- keep the source used by a persistent layer- keep images added through `addStyleImage` methodIn cases when a new style has the same layer, source or image resource, style's resources would beused instead and `MapLoadingError` event will be emitted.
addStyleCustomGeometrySource
Link copied to clipboard
open fun addStyleCustomGeometrySource(@NonNull() sourceId: String, @NonNull() options: CustomGeometrySourceOptions): Expected<String, None>
Adds a custom geometry to be used in the style.
addStyleCustomLayer
Link copied to clipboard
open fun addStyleCustomLayer(@NonNull() layerId: String, @NonNull() layerHost: CustomLayerHost, @Nullable() layerPosition: LayerPosition): Expected<String, None>
Adds a new [style custom layer](https://docs.mapbox.com/mapbox-gl-js/style-spec/#layers).Runtime style layers are valid until they are either removed or a new style is loaded.
addStyleImage
Link copied to clipboard
open fun addStyleImage(@NonNull() imageId: String, scale: Float, @NonNull() image: Image, sdf: Boolean, @NonNull() stretchX: List<ImageStretches>, @NonNull() stretchY: List<ImageStretches>, @Nullable() content: ImageContent): Expected<String, None>
Adds an image to be used in the style.
addStyleLayer
Link copied to clipboard
open fun addStyleLayer(@NonNull() properties: Value, @Nullable() layerPosition: LayerPosition): Expected<String, None>
Adds a new [style layer](https://docs.mapbox.com/mapbox-gl-js/style-spec/#layers).Runtime style layers are valid until they are either removed or a new style is loaded.
addStyleSource
Link copied to clipboard
open fun addStyleSource(@NonNull() sourceId: String, @NonNull() properties: Value): Expected<String, None>
Adds a new [style source](https://docs.mapbox.com/mapbox-gl-js/style-spec/#sources).
getStyleDefaultCamera
Link copied to clipboard
open fun getStyleDefaultCamera(): CameraOptions
Returns the map style's default camera, if any, or a default camera otherwise.The map style's default camera is defined as follows:- [center](https://docs.mapbox.com/mapbox-gl-js/style-spec/#root-center)- [zoom](https://docs.mapbox.com/mapbox-gl-js/style-spec/#root-zoom)- [bearing](https://docs.mapbox.com/mapbox-gl-js/style-spec/#root-bearing)- [pitch](https://docs.mapbox.com/mapbox-gl-js/style-spec/#root-pitch)The style default camera is re-evaluated when a new style is loaded.
getStyleImage
Link copied to clipboard
open fun getStyleImage(@NonNull() imageId: String): Image
Get an `image` from the style.
getStyleJSON
Link copied to clipboard
open fun getStyleJSON(): String
Get the JSON serialization string of the current style in use.
getStyleLayerProperties
Link copied to clipboard
open fun getStyleLayerProperties(@NonNull() layerId: String): Expected<String, Value>
Gets style layer properties.
getStyleLayerProperty
Link copied to clipboard
open fun getStyleLayerProperty(@NonNull() layerId: String, @NonNull() property: String): StylePropertyValue
Gets the value of style layer property.
getStyleLayerPropertyDefaultValue
Link copied to clipboard
open fun getStyleLayerPropertyDefaultValue(@NonNull() layerType: String, @NonNull() property: String): StylePropertyValue
Gets the default value of style layer property
getStyleLayers
Link copied to clipboard
open fun getStyleLayers(): List<StyleObjectInfo>
Returns the existing style layers.
getStyleLightProperty
Link copied to clipboard
open fun getStyleLightProperty(@NonNull() property: String): StylePropertyValue
Gets the value of a style light property.
getStyleSourceProperties
Link copied to clipboard
open fun getStyleSourceProperties(@NonNull() sourceId: String): Expected<String, Value>
Gets style source properties.
getStyleSourceProperty
Link copied to clipboard
open fun getStyleSourceProperty(@NonNull() sourceId: String, @NonNull() property: String): StylePropertyValue
Gets the value of style source property.
getStyleSourcePropertyDefaultValue
Link copied to clipboard
open fun getStyleSourcePropertyDefaultValue(@NonNull() sourceType: String, @NonNull() property: String): StylePropertyValue
Gets the default value of style source property.
getStyleSources
Link copied to clipboard
open fun getStyleSources(): List<StyleObjectInfo>
Returns the existing style sources.
getStyleTerrainProperty
Link copied to clipboard
open fun getStyleTerrainProperty(@NonNull() property: String): StylePropertyValue
Gets the value of a style terrain property.
getStyleTransition
Link copied to clipboard
open fun getStyleTransition(): TransitionOptions
Returns the map style's transition options.
getStyleURI
Link copied to clipboard
open fun getStyleURI(): String
Get the URI of the current style in use.
open fun invalidateStyleCustomGeometrySourceRegion(@NonNull() sourceId: String, @NonNull() bounds: CoordinateBounds): Expected<String, None>
Invalidate region for provided custom geometry source.
invalidateStyleCustomGeometrySourceTile
Link copied to clipboard
open fun invalidateStyleCustomGeometrySourceTile(@NonNull() sourceId: String, @NonNull() tileId: CanonicalTileID): Expected<String, None>
Invalidate tile for provided custom geometry source.
isStyleLayerPersistent
Link copied to clipboard
open fun isStyleLayerPersistent(@NonNull() layerId: String): Expected<String, Boolean>
Checks if a style layer is persistent.Note: This is an experimental API and is a subject to change.
isStyleLoaded
Link copied to clipboard
open fun isStyleLoaded(): Boolean
Check if the style is completely loaded.Note: The style specified sprite would be marked as loaded even with sprite loading error (An error will be emitted via `MapLoadingError`).Sprite loading error is not fatal and we don't want it to block the map rendering, thus the function will still return `true` if style and sources are fully loaded.
moveStyleLayer
Link copied to clipboard
open fun moveStyleLayer(@NonNull() layerId: String, @Nullable() layerPosition: LayerPosition): Expected<String, None>
Moves an existing style layer
removeStyleImage
Link copied to clipboard
open fun removeStyleImage(@NonNull() imageId: String): Expected<String, None>
Removes an image from the style.
removeStyleLayer
Link copied to clipboard
open fun removeStyleLayer(@NonNull() layerId: String): Expected<String, None>
Removes an existing style layer.
removeStyleSource
Link copied to clipboard
open fun removeStyleSource(@NonNull() sourceId: String): Expected<String, None>
Removes an existing style source.
setStyleCustomGeometrySourceTileData
Link copied to clipboard
open fun setStyleCustomGeometrySourceTileData(@NonNull() sourceId: String, @NonNull() tileId: CanonicalTileID, @NonNull() featureCollection: List<Feature>): Expected<String, None>
Set tile data of a custom geometry.
setStyleJSON
Link copied to clipboard
open fun setStyleJSON(@NonNull() json: String)
Load the style from a provided JSON string.
setStyleLayerProperties
Link copied to clipboard
open fun setStyleLayerProperties(@NonNull() layerId: String, @NonNull() properties: Value): Expected<String, None>
Sets style layer properties.This method can be used to perform batch update for a style layer properties.
setStyleLayerProperty
Link copied to clipboard
open fun setStyleLayerProperty(@NonNull() layerId: String, @NonNull() property: String, @NonNull() value: Value): Expected<String, None>
Sets a value to a style layer property.
setStyleLight
Link copied to clipboard
open fun setStyleLight(@NonNull() properties: Value): Expected<String, None>
Sets the style global [light](https://docs.mapbox.com/mapbox-gl-js/style-spec/#light) properties.
setStyleLightProperty
Link copied to clipboard
open fun setStyleLightProperty(@NonNull() property: String, @NonNull() value: Value): Expected<String, None>
Sets a value to the the style light property.
setStyleSourceProperties
Link copied to clipboard
open fun setStyleSourceProperties(@NonNull() sourceId: String, @NonNull() properties: Value): Expected<String, None>
Sets style source properties.This method can be used to perform batch update for a style source properties.
setStyleSourceProperty
Link copied to clipboard
open fun setStyleSourceProperty(@NonNull() sourceId: String, @NonNull() property: String, @NonNull() value: Value): Expected<String, None>
Sets a value to a style source property.Note: When setting the `data` property of a `geojson` source, this method never returns an error.In case of success, a `map-loaded` event will be propagated.
setStyleTerrain
Link copied to clipboard
open fun setStyleTerrain(@NonNull() properties: Value): Expected<String, None>
Sets the style global [terrain](https://docs.mapbox.com/mapbox-gl-js/style-spec/#terrain) properties.
setStyleTerrainProperty
Link copied to clipboard
open fun setStyleTerrainProperty(@NonNull() property: String, @NonNull() value: Value): Expected<String, None>
Sets a value to the the style terrain property.
setStyleTransition
Link copied to clipboard
open fun setStyleTransition(@NonNull() transitionOptions: TransitionOptions)
Overrides the map style's transition options with user-provided options.The style transition is re-evaluated when a new style is loaded.
setStyleURI
Link copied to clipboard
open fun setStyleURI(@NonNull() uri: String)
Load style from provided URI.This is an asynchronous call.
styleLayerExists
Link copied to clipboard
open fun styleLayerExists(@NonNull() layerId: String): Boolean
Checks whether a given style layer exists.
styleSourceExists
Link copied to clipboard
open fun styleSourceExists(@NonNull() sourceId: String): Boolean
Checks whether a given style source exists.
subscribe
Link copied to clipboard
open fun subscribe(@NonNull() observer: Observer, @NonNull() events: List<String>)
Subscribes an `observer` to a provided array of event types.The `observable` will hold a strong reference to an `observer` instance, therefore,in order to stop receiving notifications, caller must call `unsubscribe` with an`observer` instance used for an initial subscription.
unsubscribe
Link copied to clipboard
open fun unsubscribe(@NonNull() observer: Observer)
Unsubscribes an `observer` from all events.
open fun unsubscribe(@NonNull() observer: Observer, @NonNull() events: List<String>)
Unsubscribes an `observer` from a provided array of event types.
updateStyleImageSourceImage
Link copied to clipboard
open fun updateStyleImageSourceImage(@NonNull() sourceId: String, @NonNull() image: Image): Expected<String, None>
Updates the image of an [image style source](https://docs.mapbox.com/mapbox-gl-js/style-spec/#sources-image).

Inheritors

CameraManager
Link copied to clipboard